package com.hopes.bizz.risk.control.bo;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import com.hopes.bizz.risk.setting.entity.RiskEffectEvaluationConfigEntity;
import lombok.Getter;
import lombok.Setter;

import java.util.HashMap;
import java.util.Map;
import java.util.Objects;

import static com.hopes.bizz.risk.common.constant.RiskDicConstant.*;

/**
 * @author lyb
 * @version 1.0
 * @description: 获取双重机制运行效果评估设分数工具
 * @date 2023/7/4 17:21
 */

@Getter
@Setter
public class RiskEffectEvaluationScore {

    /**
     * 运行效果-优
     */
    private Integer excellent = 90;
    /**
     * 运行效果-良(左边界)
     */
    private Integer goodLimitLeft = 80;
    /**
     * 运行效果-良(右边界)
     */
    private Integer goodLimitRight = 90;
    /**
     * 运行效果-中(左边界)
     */
    private Integer mediumLimitLeft = 70;
    /**
     * 运行效果-中(右边界)
     */
    private Integer mediumLimitRight = 80;
    /**
     * 运行效果-差
     */
    private Integer poor = 70;
    /**
     * 主要负责人未全覆盖排查
     */
    private Integer principalUnchecked = 10;
    /**
     * 技术负责人未全覆盖排查
     */
    private Integer technicianUnchecked = 5;
    /**
     * 操作负责人未全覆盖排查
     */
    private Integer operaterUnchecked = 5;
    /**
     * 30日内未上报隐患扣分
     */
    private Integer hidNotReport = 10;
    /**
     * 未上报隐患每周扣分
     */
    private Integer hidNotReportLimitWeek = 5;
    /**
     * 覆盖风险对象标识
     */
    private Boolean riskFlag = true;
    /**
     * 风险数量标识
     */
    private Boolean riskObjectNumberFlag = true;
    /**
     * 风险任务时效标识
     */
    private Boolean taskTimelinessFlag = true;
    /**
     * 风险负责人类型标识
     */
    private Boolean riskPrincipalFlag = true;
    /**
     * 重大隐患未整改标识
     */
    private Boolean hidExceedTimeFlag = true;
    /**
     * 移动端配置标识
     */
    private Boolean mobileTerminalFlag = true;
    /**
     * 任务完成检查情况得分总分
     */
    private Double riskCheckTaskTotalScore = 50d;
    /**
     * 隐患治理情况得分总分
     */
    private Double hidTaskTotalScore = 50d;

    public RiskEffectEvaluationScore() {
    }

    public RiskEffectEvaluationScore(RiskEffectEvaluationConfigEntity riskEffectEvaluationConfig) {
        if (Objects.nonNull(riskEffectEvaluationConfig)) {
            BeanUtil.copyProperties(riskEffectEvaluationConfig, this,
                    CopyOptions.create().setIgnoreNullValue(true).setIgnoreError(true));
        }
    }


    // 获取双体系任务排查减分类型
    public Map<Integer, Integer> getRiskCheckTaskDeductMap() {
        Map<Integer, Integer> map = new HashMap<>();
        map.put(RISK_WORK_TYPE_1, this.getPrincipalUnchecked());
        map.put(RISK_WORK_TYPE_2, this.getTechnicianUnchecked());
        map.put(RISK_WORK_TYPE_3, this.getOperaterUnchecked());
        return map;
    }


    // 获取包保责任人和其对应项数量
    public Map<Integer, Integer> getRiskGuaranteePrincipalTypeMap() {
        Map<Integer, Integer> map = new HashMap<>();
        map.put(RISK_WORK_TYPE_1, RISK_WORK_TYPE_COUNT_1);
        map.put(RISK_WORK_TYPE_2, RISK_WORK_TYPE_COUNT_2);
        map.put(RISK_WORK_TYPE_3, RISK_WORK_TYPE_COUNT_3);
        return map;
    }
}
